package com.levy.contronller.javase.designModel.single;

/**
 * Created by levy on 2019/7/8.
 */
public class StaticInner {

    private StaticInner(){
        if (SingleTion.instance != null ){
            throw new IllegalStateException();
        }
    }

    private static class SingleTion{
        private static StaticInner instance = new StaticInner();

    }

    public static StaticInner getInstance(){
        return SingleTion.instance;
    }


    public static void main(String[] args) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i= 0;i<10;i++){
                    StaticInner instance = StaticInner.getInstance();

                    System.out.println(instance.hashCode());
                }
            }
        }).start();

    }


}